<?php

/**
 * Video filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseVideoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'               => new sfWidgetFormFilterInput(),
      'artist'              => new sfWidgetFormFilterInput(),
      'source'              => new sfWidgetFormFilterInput(),
      'tag'                 => new sfWidgetFormFilterInput(),
      'duration'            => new sfWidgetFormFilterInput(),
      'publish_time'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'create_time'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'modify_time'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'snapshot_big'        => new sfWidgetFormFilterInput(),
      'snapshot_small'      => new sfWidgetFormFilterInput(),
      'hit_i'               => new sfWidgetFormFilterInput(),
      'hit_mask_i'          => new sfWidgetFormFilterInput(),
      'status_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'add_empty' => true)),
      'catalog_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
      'sub_catalog_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog_2'), 'add_empty' => true)),
      'keyword'             => new sfWidgetFormFilterInput(),
      'brief'               => new sfWidgetFormFilterInput(),
      'member_level_i'      => new sfWidgetFormFilterInput(),
      'content_type_i'      => new sfWidgetFormFilterInput(),
      'link'                => new sfWidgetFormFilterInput(),
      'relate_rule'         => new sfWidgetFormFilterInput(),
      'video_type'          => new sfWidgetFormFilterInput(),
      'is_audit_b'          => new sfWidgetFormFilterInput(),
      'daily_hit'           => new sfWidgetFormFilterInput(),
      'weekly_hit'          => new sfWidgetFormFilterInput(),
      'monthly_hit'         => new sfWidgetFormFilterInput(),
      'prim_video_group_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Videogroup'), 'add_empty' => true)),
      'order_i'             => new sfWidgetFormFilterInput(),
      'system_user_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
      'is_header_b'         => new sfWidgetFormFilterInput(),
      'is_recommend_b'      => new sfWidgetFormFilterInput(),
      'is_on_top_b'         => new sfWidgetFormFilterInput(),
      'is_focus_b'          => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'title'               => new sfValidatorPass(array('required' => false)),
      'artist'              => new sfValidatorPass(array('required' => false)),
      'source'              => new sfValidatorPass(array('required' => false)),
      'tag'                 => new sfValidatorPass(array('required' => false)),
      'duration'            => new sfValidatorPass(array('required' => false)),
      'publish_time'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'create_time'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'modify_time'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'snapshot_big'        => new sfValidatorPass(array('required' => false)),
      'snapshot_small'      => new sfValidatorPass(array('required' => false)),
      'hit_i'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'hit_mask_i'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'status_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Status'), 'column' => 'status_id')),
      'catalog_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Catalog'), 'column' => 'catalog_id')),
      'sub_catalog_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Catalog_2'), 'column' => 'catalog_id')),
      'keyword'             => new sfValidatorPass(array('required' => false)),
      'brief'               => new sfValidatorPass(array('required' => false)),
      'member_level_i'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'content_type_i'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'link'                => new sfValidatorPass(array('required' => false)),
      'relate_rule'         => new sfValidatorPass(array('required' => false)),
      'video_type'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_audit_b'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'daily_hit'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'weekly_hit'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'monthly_hit'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'prim_video_group_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Videogroup'), 'column' => 'video_group_id')),
      'order_i'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'system_user_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Systemuser'), 'column' => 'system_user_id')),
      'is_header_b'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_recommend_b'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_on_top_b'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_focus_b'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('video_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Video';
  }

  public function getFields()
  {
    return array(
      'video_id'            => 'Number',
      'title'               => 'Text',
      'artist'              => 'Text',
      'source'              => 'Text',
      'tag'                 => 'Text',
      'duration'            => 'Text',
      'publish_time'        => 'Date',
      'create_time'         => 'Date',
      'modify_time'         => 'Date',
      'snapshot_big'        => 'Text',
      'snapshot_small'      => 'Text',
      'hit_i'               => 'Number',
      'hit_mask_i'          => 'Number',
      'status_id'           => 'ForeignKey',
      'catalog_id'          => 'ForeignKey',
      'sub_catalog_id'      => 'ForeignKey',
      'keyword'             => 'Text',
      'brief'               => 'Text',
      'member_level_i'      => 'Number',
      'content_type_i'      => 'Number',
      'link'                => 'Text',
      'relate_rule'         => 'Text',
      'video_type'          => 'Number',
      'is_audit_b'          => 'Number',
      'daily_hit'           => 'Number',
      'weekly_hit'          => 'Number',
      'monthly_hit'         => 'Number',
      'prim_video_group_id' => 'ForeignKey',
      'order_i'             => 'Number',
      'system_user_id'      => 'ForeignKey',
      'is_header_b'         => 'Number',
      'is_recommend_b'      => 'Number',
      'is_on_top_b'         => 'Number',
      'is_focus_b'          => 'Number',
    );
  }
}
